package com.codi.api.controller;

import com.codi.api.security.UserUtil;
import com.codi.bus.constant.GlobalConstant;
import com.codi.goldlife.external.IntegralServiceApi;
import com.codi.goldlife.external.databean.ResultBean;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by asus on 2017/12/21.
 */

@Slf4j
@RestController
@RequestMapping("/integral")
public class IntegralController {
    @Autowired
    private IntegralServiceApi integralServiceApi;

    @GetMapping("/getIntegralWay")
    public ResultBean getIntegralWay(){
        return integralServiceApi.getIntegralWay();
    }

    @GetMapping("/getIntegral")
    public ResultBean getIntegral(){
        return integralServiceApi.getIntegral(UserUtil.getLoginUserId().toString(),GlobalConstant.INTEGRAL_CHANNEL_ID);
    }

    @GetMapping("/getIntegralRecord")
    public ResultBean getIntegralRecord(){
        return integralServiceApi.getIntegralRecord(UserUtil.getLoginUserId().toString(),GlobalConstant.INTEGRAL_CHANNEL_ID);
    }

}
